package org.ym.system.application.queryservice;

import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.ym.database.hibernate.query.QueryFilter;
import org.ym.system.domain.model.entity.SysUser;
import org.ym.system.domain.repository.SysUserRepositoryService;

import javax.annotation.Resource;

/**
 * @author ym
 */
@Service
@Transactional(readOnly = true)
public class SysUserQueryService {
    @Resource
    SysUserRepositoryService sysUserRepositoryService;
    /**
     * 根据逻辑主键获取数据
     * @param id 逻辑主键
     * @return SysUser
     */
    public SysUser get(Long id){
        return sysUserRepositoryService.getById(id).get();
    }
    /**
     * 分页查询
     * @param queryFilter 查询条件
     * @return Page<SysUser>
     */
    public Page<SysUser> page(QueryFilter queryFilter){
        return sysUserRepositoryService.queryPage(queryFilter, SysUser.class);
    }
}
